input {
	file {
		path => "/home/<%= fetch(:user) %>/apps/<%= fetch(:application) %>/shared/log/lograge_*"
		type => "<%= fetch(:application) %>"
	}
}
filter{
	if [type] == "<%= fetch(:application) %>" {
		mutate {
			#square brackets should be removed, otherwise parse error will happen
			gsub => [ "message", "\[|\]", "" ]
		}
		json{
			source => "message"
		}
		useragent {
			source => "agent_string"
		}
		geoip {
			source => "remote_ip"
		}
	}
}
output {
	if [type] == "<%= fetch(:application) %>" {
		elasticsearch {
			index => "<%= fetch(:application) %>"
		}
	}
}